<!DOCTYPE html><html><head><title>Ext.data.Types | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.data.Types',
        docClass: 'Ext.data.Types',
        docReq: 'Ext.data.Types',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Types.html#Ext-data.Types';
    clsInfo = {"methods":[],"cfgs":[],"properties":["AUTO","BOOL","BOOLEAN","DATE","FLOAT","INT","INTEGER","NUMBER","STRING","stripRe"],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Types.html#Ext-data.Types" target="_blank">Ext.data.Types</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>This is s static class containing the system-supplied data types which may be given to a <a href="Ext.data.Field.html" rel="Ext.data.Field" class="docClass">Field</a>.<p/>
<p>The properties in this class are used as type indicators in the <a href="Ext.data.Field.html" rel="Ext.data.Field" class="docClass">Field</a> class, so to
test whether a Field is of a certain type, compare the <a href="Ext.data.Field.html#type" rel="Ext.data.Field#type" class="docClass">type</a> property against properties
of this class.</p>
<p>Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE.
each type definition must contain three properties:</p>
<div class="mdetail-params"><ul>
<li><code>convert</code> : <i>Function</i><div class="sub-desc">A function to convert raw data values from a data block into the data
to be stored in the Field. The function is passed the collowing parameters:
<div class="mdetail-params"><ul>
<li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
the configured <tt><a href="Ext.data.Field.html#defaultValue" rel="Ext.data.Field#defaultValue" class="docClass">defaultValue</a></tt>.</div></li>
<li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
Depending on the Reader type, this could be an Array (<a href="Ext.data.reader.Array.html" rel="Ext.data.reader.Array" class="docClass">ArrayReader</a>), an object
(<a href="Ext.data.reader.Json.html" rel="Ext.data.reader.Json" class="docClass">JsonReader</a>), or an XML element.</div></li>
</ul></div></div></li>
<li><code>sortType</code> : <i>Function</i> <div class="sub-desc">A function to convert the stored data into comparable form, as defined by <a href="Ext.data.SortTypes.html" rel="Ext.data.SortTypes" class="docClass">Ext.data.SortTypes</a>.</div></li>
<li><code>type</code> : <i>String</i> <div class="sub-desc">A textual data type name.</div></li>
</ul></div>
<p>For example, to create a VELatLong field (See the Microsoft Bing Mapping API) containing the latitude/longitude value of a datapoint on a map from a JsonReader data block
which contained the properties <code>lat</code> and <code>long</code>, you would define a new data type like this:</p>
<pre class="prettyprint"><code>// Add a new Field data type which stores a VELatLong object in the Record.
Ext.data.Types.VELATLONG = {
    convert: function(v, data) {
        return new VELatLong(data.lat, data.long);
    },
    sortType: function(v) {
        return v.Latitude;  // When sorting, order by latitude
    },
    type: 'VELatLong'
};
</code></pre>
<p>Then, when declaring a Model, use 
<pre class="prettyprint"><code>var types = Ext.data.Types; // allow shorthand type access
Ext.define('Unit',
    extend: 'Ext.data.Model', 
    fields: [
        { name: 'unitName', mapping: 'UnitName' },
        { name: 'curSpeed', mapping: 'CurSpeed', type: types.INT },
        { name: 'latitude', mapping: 'lat', type: types.FLOAT },
        { name: 'latitude', mapping: 'lat', type: types.FLOAT },
        { name: 'position', type: types.VELATLONG }
    ]
});
</code></pre>

<div class="members"><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-AUTO" class="member f ni"><a href="Ext.data.Types.html#property-AUTO" rel="property-AUTO" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-AUTO" class="viewSource">view source</a></div><a name="AUTO"></a><a name="property-AUTO"></a><a href="Ext.data.Types.html#" rel="property-AUTO" class="cls expand">AUTO</a><span> : Object.</span></div><div class="description"><div class="short"><p>This data type means that no conversion is applied to the raw data before it is placed into a Record.</p>
</div><div class="long"><p>This data type means that no conversion is applied to the raw data before it is placed into a Record.</p>
</div></div></div><div id="property-BOOL" class="member ni"><a href="Ext.data.Types.html#property-BOOL" rel="property-BOOL" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-BOOL" class="viewSource">view source</a></div><a name="BOOL"></a><a name="property-BOOL"></a><a href="Ext.data.Types.html#" rel="property-BOOL" class="cls expand">BOOL</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into a boolean before it is placed into
a Record. The string "tru...</div><div class="long"><p>This data type means that the raw data is converted into a boolean before it is placed into
a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>


<p>The synonym <code>BOOLEAN</code> is equivalent.</p>

</div></div></div><div id="property-BOOLEAN" class="member ni"><a href="Ext.data.Types.html#property-BOOLEAN" rel="property-BOOLEAN" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-BOOLEAN" class="viewSource">view source</a></div><a name="BOOLEAN"></a><a name="property-BOOLEAN"></a><a href="Ext.data.Types.html#" rel="property-BOOLEAN" class="cls expand">BOOLEAN</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into a boolean before it is placed into
a Record. The string "tru...</div><div class="long"><p>This data type means that the raw data is converted into a boolean before it is placed into
a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>


<p>The synonym <code>BOOL</code> is equivalent.</p>

</div></div></div><div id="property-DATE" class="member ni"><a href="Ext.data.Types.html#property-DATE" rel="property-DATE" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-DATE" class="viewSource">view source</a></div><a name="DATE"></a><a name="property-DATE"></a><a href="Ext.data.Types.html#" rel="property-DATE" class="cls expand">DATE</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into a Date before it is placed into a Record.
The date format is...</div><div class="long"><p>This data type means that the raw data is converted into a Date before it is placed into a Record.
The date format is specified in the constructor of the <a href="Ext.data.Field.html" rel="Ext.data.Field" class="docClass">Ext.data.Field</a> to which this type is
being applied.</p>
</div></div></div><div id="property-FLOAT" class="member ni"><a href="Ext.data.Types.html#property-FLOAT" rel="property-FLOAT" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-FLOAT" class="viewSource">view source</a></div><a name="FLOAT"></a><a name="property-FLOAT"></a><a href="Ext.data.Types.html#" rel="property-FLOAT" class="cls expand">FLOAT</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into a number before it is placed into a Record.

The synonym NUM...</div><div class="long"><p>This data type means that the raw data is converted into a number before it is placed into a Record.</p>

<p>The synonym <code>NUMBER</code> is equivalent.</p>

</div></div></div><div id="property-INT" class="member ni"><a href="Ext.data.Types.html#property-INT" rel="property-INT" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-INT" class="viewSource">view source</a></div><a name="INT"></a><a name="property-INT"></a><a href="Ext.data.Types.html#" rel="property-INT" class="cls expand">INT</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into an integer before it is placed into a Record.

The synonym I...</div><div class="long"><p>This data type means that the raw data is converted into an integer before it is placed into a Record.</p>

<p>The synonym <code>INTEGER</code> is equivalent.</p>

</div></div></div><div id="property-INTEGER" class="member ni"><a href="Ext.data.Types.html#property-INTEGER" rel="property-INTEGER" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-INTEGER" class="viewSource">view source</a></div><a name="INTEGER"></a><a name="property-INTEGER"></a><a href="Ext.data.Types.html#" rel="property-INTEGER" class="cls expand">INTEGER</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into an integer before it is placed into a Record.

The synonym I...</div><div class="long"><p>This data type means that the raw data is converted into an integer before it is placed into a Record.</p>

<p>The synonym <code>INT</code> is equivalent.</p>

</div></div></div><div id="property-NUMBER" class="member ni"><a href="Ext.data.Types.html#property-NUMBER" rel="property-NUMBER" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-NUMBER" class="viewSource">view source</a></div><a name="NUMBER"></a><a name="property-NUMBER"></a><a href="Ext.data.Types.html#" rel="property-NUMBER" class="cls expand">NUMBER</a><span> : Object.</span></div><div class="description"><div class="short">This data type means that the raw data is converted into a number before it is placed into a Record.

The synonym FLO...</div><div class="long"><p>This data type means that the raw data is converted into a number before it is placed into a Record.</p>

<p>The synonym <code>FLOAT</code> is equivalent.</p>

</div></div></div><div id="property-STRING" class="member ni"><a href="Ext.data.Types.html#property-STRING" rel="property-STRING" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-STRING" class="viewSource">view source</a></div><a name="STRING"></a><a name="property-STRING"></a><a href="Ext.data.Types.html#" rel="property-STRING" class="cls expand">STRING</a><span> : Object.</span></div><div class="description"><div class="short"><p>This data type means that the raw data is converted into a String before it is placed into a Record.</p>
</div><div class="long"><p>This data type means that the raw data is converted into a String before it is placed into a Record.</p>
</div></div></div><div id="property-stripRe" class="member ni"><a href="Ext.data.Types.html#property-stripRe" rel="property-stripRe" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Types.html" class="definedIn docClass">Ext.data.Types</a><br/><a href="../source/Types.html#Ext-data.Types-property-stripRe" class="viewSource">view source</a></div><a name="stripRe"></a><a name="property-stripRe"></a><a href="Ext.data.Types.html#" rel="property-stripRe" class="cls expand">stripRe</a><span> : Regexp</span></div><div class="description"><div class="short">A regular expression for stripping non-numeric characters from a numeric value. Defaults to /[\$,%]/g.
This should be...</div><div class="long"><p>A regular expression for stripping non-numeric characters from a numeric value. Defaults to <tt>/[\$,%]/g</tt>.
This should be overridden for localization.</p>
</div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>